import { fifthColor, bgColor } from '@/utils/study.js'

export const yAxisSplitLine = {
  show: true,
  lineStyle: {
    color: [
      bgColor, // 根据 -0.1 是否移除
      fifthColor[11],
      ...[...Array(9)].map((e) => bgColor),
      fifthColor[10],
      ...[...Array(9)].map((e) => bgColor),
      fifthColor[9],
      ...[...Array(9)].map((e) => bgColor),
      fifthColor[8],
      ...[...Array(9)].map((e) => bgColor),
      fifthColor[7],
      ...[...Array(9)].map((e) => bgColor),
      fifthColor[6],
      ...[...Array(9)].map((e) => bgColor),
      fifthColor[5],
      ...[...Array(9)].map((e) => bgColor),
      fifthColor[4],
      ...[...Array(9)].map((e) => bgColor),
      fifthColor[3],
      ...[...Array(9)].map((e) => bgColor),
      fifthColor[2]
    ],
    // type: 'solid'
    type: 'dashed'
  }
}

export const formatter = groupds => {
  return value => {
    if (Number.isInteger(value)) {
      const group = groupds[value]
      const start = group[0]
      const end = group[group.length - 1]
      return `${start} ~ ${end}`
    }
    return ''
  }
}
